package com.xhsj.user.sms.purchase.web;

import com.xhsj.user.config.ApplicationContextHelper;
import com.xhsj.user.utils.Message;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.lang.reflect.Method;
import java.util.Map;

/**
 * @Author: liuqinghua
 * @Description:
 * @Data:2020/5/20
 */
@Slf4j
@Api(tags = "审批页面相关")
@RestController
@RequestMapping("/purchase/tbPurchaseApplyPage")
public class TbPurchaseApplyPageController {


    @ApiOperation(value = "审批页面", notes = "审批页面")
    @PostMapping(value="/purchaseApplyPage")
    public Message purchaseApplyPage(@RequestBody Map<String,Object> param) {
        try {
            param.get("methodName");
            Class<?> tbPurchaseApplyController = Class.forName("com.xhsj.user.sms.purchase.web.TbPurchaseApplyPageController");
            Object obj = ApplicationContextHelper.popBean(tbPurchaseApplyController);
            Method departmentTaskDetailsList = tbPurchaseApplyController.getMethod(String.valueOf(param.get("methodName")), String.class);
            Message invoke = (Message) departmentTaskDetailsList.invoke(obj,"59fc6902a9364f13962b59651f5f6145");
            return invoke;
        }catch (Exception e){
            e.printStackTrace();
            log.error("错误信息",e);
            return Message.error(1,"错误");
        }

    }

}
